package com.cheetah.start.common.utils;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author xjh
 * @date 2023/05/19
 */
@Slf4j
@Component
public class ProfileUtil {

    public static String active;

    public static boolean isDev() {
        return "dev".equals(active);
    }

    public static boolean isPro() {
        return "pro".equals(active);
    }

    public static boolean isTest() {
        return "test".equals(active);
    }

    @Value("${spring.profiles.active}")
    public void setActive(String active) {
        log.info("运行环境:[{}]", active);
        ProfileUtil.active = active;
    }
}
